package com.kaifamiao.www.ioDemo.do0921;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class FileInputStreamDemo01 {

    public static void main(String[] args) {
        File file = new File("E:\\kaifamiao\\workspace\\idea--space\\io\\file-input.txt");
        if (file.exists()&&file.isFile()){
            System.out.println("file length" + file.length());
            try (FileInputStream fis = new FileInputStream(file);){
                System.out.println(fis.available());
                while (true){
                    int b = fis.read();
                    if (b == -1){
                        break;
                    }
                   char c = (char) b;
                    System.out.print(c);
                }
                System.out.println(fis.available());
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }


        }

    }
}
